//
//  HttpRequest.h
//  youyue
//
//  Created by oceans on 2018/8/15.
//

#import <Foundation/Foundation.h>
#import "GlobalPath.h"

#define defweakself __weak typeof(self) weakself = self;
typedef void(^HttpRequestSuccessfulBlock)(id _Nullable result);
typedef void(^HttpRequestFailedBlock)(int code, NSString * _Nullable errMsg);

@interface MetaModel : NSObject

@property (assign, nonatomic) int total_pages;
@property (assign, nonatomic) int count;
@property (assign, nonatomic) int total;
@property (assign, nonatomic) int current_page;
@property (assign, nonatomic) int per_page;
- (instancetype _Nullable )initWithDic:(NSDictionary *_Nullable)dic;
@end

@interface HttpRequest : NSObject

+ (void)getURL:(NSString*_Nullable)url paras:(NSDictionary*_Nullable)paras showProgress:(BOOL)showProgress successful:(HttpRequestSuccessfulBlock _Nullable )successful failed:(HttpRequestFailedBlock _Nullable )failed;
+ (void)postURL:(NSString*_Nullable)url paras:(NSDictionary*_Nullable)paras showProgress:(BOOL)showProgress successful:(HttpRequestSuccessfulBlock _Nullable )successful failed:(HttpRequestFailedBlock _Nullable )failed;
+ (void)uploadImage:(NSString*_Nullable)url paras:(NSDictionary*_Nullable)paras image:(NSData *_Nullable)image showProgress:(BOOL)showProgress successful:(HttpRequestSuccessfulBlock _Nullable )successful failed:(HttpRequestFailedBlock _Nullable )failed;
@end
